home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevMac / CIncludes / QD3DRenderer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  42.3 KB  |  1,269 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3DRenderer.h
  3.  
  4.      Contains:    Q3Renderer types and routines                                          
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QD3DRENDERER__
  19. #define __QD3DRENDERER__
  20.  
  21. #ifndef __QD3D__
  22. #include <QD3D.h>
  23. #endif
  24. #ifndef __QD3DSET__
  25. #include <QD3DSet.h>
  26. #endif
  27. #ifndef __QD3DVIEW__
  28. #include <QD3DView.h>
  29. #endif
  30.  
  31. #if TARGET_OS_MAC
  32. #ifndef __EVENTS__
  33. #include <Events.h>
  34. #endif
  35. #endif  /* TARGET_OS_MAC */
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=power
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59. #if PRAGMA_ENUM_ALWAYSINT
  60.     #pragma enumsalwaysint on
  61. #elif PRAGMA_ENUM_OPTIONS
  62.     #pragma option enum=int
  63. #elif PRAGMA_ENUM_PACK
  64.     #if __option(pack_enums)
  65.         #define PRAGMA_ENUM_PACK__QD3DRENDERER__
  66.     #endif
  67.     #pragma options(!pack_enums)
  68. #endif
  69.  
  70. /******************************************************************************
  71.  **                                                                             **
  72.  **                            User Interface Things                             **
  73.  **                                                                             **
  74.  *****************************************************************************/
  75. #if TARGET_OS_MAC
  76. /*
  77.  *  A callback to an application's event handling code. This is needed to    
  78.  *  support movable modal dialogs. The dialog's event filter calls this      
  79.  *  callback with events it does not handle.                                 
  80.  *  If an application handles the event it should return kQ3True.            
  81.  *  If the application does not handle the event it must return kQ3False and 
  82.  *  the dialog's event filter will pass the event to the system unhandled.   
  83.  */
  84. typedef CALLBACK_API_C( TQ3Boolean , TQ3MacOSDialogEventHandler )(const EventRecord *event);
  85.  
  86. struct TQ3DialogAnchor {
  87.     TQ3MacOSDialogEventHandler         clientEventHandler;
  88. };
  89. typedef struct TQ3DialogAnchor            TQ3DialogAnchor;
  90. #endif  /* TARGET_OS_MAC */
  91.  
  92. #if TARGET_OS_WIN32
  93.  
  94. struct TQ3DialogAnchor {
  95.     HWND                             ownerWindow;
  96. };
  97. typedef struct TQ3DialogAnchor            TQ3DialogAnchor;
  98. #endif  /* TARGET_OS_WIN32 */
  99.  
  100. #if TARGET_OS_UNIX
  101.  
  102. struct TQ3DialogAnchor {
  103.     void *                            notUsed;                    /* place holder */
  104. };
  105. typedef struct TQ3DialogAnchor            TQ3DialogAnchor;
  106. #endif  /* TARGET_OS_UNIX */
  107.  
  108. /******************************************************************************
  109.  **                                                                             **
  110.  **                            Renderer Functions                                 **
  111.  **                                                                             **
  112.  *****************************************************************************/
  113. EXTERN_API_C( TQ3RendererObject )
  114. Q3Renderer_NewFromType            (TQ3ObjectType             rendererObjectType);
  115.  
  116. EXTERN_API_C( TQ3ObjectType )
  117. Q3Renderer_GetType                (TQ3RendererObject         renderer);
  118.  
  119.  
  120. /* Q3Renderer_Flush has been replaced by Q3View_Flush */
  121. /* Q3Renderer_Sync has been replaced by Q3View_Sync */
  122.  
  123. /*
  124.  *    Q3Renderer_IsInteractive
  125.  *        Determine if this renderer is intended to be used interactively.
  126.  */
  127. EXTERN_API_C( TQ3Boolean )
  128. Q3Renderer_IsInteractive        (TQ3RendererObject         renderer);
  129.  
  130.  
  131. /*
  132.  *    Q3Renderer_HasModalConfigure
  133.  *        Determine if this renderer has a modal settings dialog.
  134.  *
  135.  *    Q3Renderer_ModalConfigure
  136.  *        Have the renderer pop up a modal dialog box to configure its settings.
  137.  *    dialogAnchor - is platform specific data passed by the client to support
  138.  *      movable modal dialogs. 
  139.  *    MacOS: this is a callback to the calling application's event handler.
  140.  *      The renderer calls this function with events not handled by the 
  141.  *      settings dialog. This is necessary in order to support movable modal 
  142.  *      dialogs. An application's event handler must return kQ3True if it 
  143.  *      handles the event passed to the callback or kQ3False if not. 
  144.  *      An application which doesn't want to support a movable modal configure
  145.  *      dialog should pass NULL for the clientEventHandler of TQ3DialogAnchor.
  146.  *    Win32: this is the HWND of the owning window (typically an application's
  147.  *      main window).
  148.  *  canceled - returns a boolean inditacating that the user canceled the 
  149.  *    dialog.
  150.  *      
  151.  */
  152. EXTERN_API_C( TQ3Boolean )
  153. Q3Renderer_HasModalConfigure    (TQ3RendererObject         renderer);
  154.  
  155. EXTERN_API_C( TQ3Status )
  156. Q3Renderer_ModalConfigure        (TQ3RendererObject         renderer,
  157.                                  TQ3DialogAnchor         dialogAnchor,
  158.                                  TQ3Boolean *            canceled);
  159.  
  160. /*
  161.  *    Q3RendererClass_GetNickNameString
  162.  *        Allows an application to get a renderers name string, the 
  163.  *        renderer is responsible for storing this in a localizable format
  164.  *        for example as a resource.  This string can then be used to provide
  165.  *        a selection mechanism for an application (for example in a menu).
  166.  *
  167.  *        If this call returns nil in the supplied string, then the App may 
  168.  *         choose to use the class name for the renderer.  You should always 
  169.  *        try to get the name string before using the class name, since the
  170.  *        class name is not localizable.
  171.  */
  172. EXTERN_API_C( TQ3Status )
  173. Q3RendererClass_GetNickNameString (TQ3ObjectType         rendererClassType,
  174.                                  TQ3ObjectClassNameString  rendererClassString);
  175.  
  176.  
  177. /*
  178.  *    Q3Renderer_GetConfigurationData
  179.  *        Allows an application to collect private renderer configuration data
  180.  *      which it will then save. For example in a preference file or in a 
  181.  *        style template. An application should tag this data with the 
  182.  *        Renderer's object  name.
  183.  *    
  184.  *        if dataBuffer is NULL actualDataSize returns the required size in 
  185.  *        bytes of a data buffer large enough to store private data. 
  186.  *
  187.  *      bufferSize is the actual size of the memory block pointed to by 
  188.  *        dataBuffer
  189.  *
  190.  *        actualDataSize - on return the actual number of bytes written to the 
  191.  *        buffer or if dataBuffer is NULL the required size of dataBuffer
  192.  * 
  193.  */
  194. EXTERN_API_C( TQ3Status )
  195. Q3Renderer_GetConfigurationData    (TQ3RendererObject         renderer,
  196.                                  unsigned char *        dataBuffer,
  197.                                  unsigned long             bufferSize,
  198.                                  unsigned long *        actualDataSize);
  199.  
  200. EXTERN_API_C( TQ3Status )
  201. Q3Renderer_SetConfigurationData    (TQ3RendererObject         renderer,
  202.                                  unsigned char *        dataBuffer,
  203.                                  unsigned long             bufferSize);
  204.  
  205.  
  206.  
  207. /******************************************************************************
  208.  **                                                                             **
  209.  **                        Interactive Renderer Specific Functions                 **
  210.  **                                                                             **
  211.  *****************************************************************************/
  212. /* CSG IDs attribute */
  213. #define kQ3AttributeTypeConstructiveSolidGeometryID        Q3_OBJECT_TYPE('c','s','g','i')
  214. /* Object IDs, to be applied as attributes on geometries */
  215. #define kQ3SolidGeometryObjNone (-1)
  216. #define kQ3SolidGeometryObjA     0
  217. #define kQ3SolidGeometryObjB     1
  218. #define kQ3SolidGeometryObjC     2
  219. #define kQ3SolidGeometryObjD     3
  220. #define kQ3SolidGeometryObjE     4
  221. /* Possible CSG equations */
  222.  
  223. enum TQ3CSGEquation {
  224.     kQ3CSGEquationAandB            = (long)0x88888888,
  225.     kQ3CSGEquationAandnotB        = 0x22222222,
  226.     kQ3CSGEquationAanBonCad        = 0x2F222F22,
  227.     kQ3CSGEquationnotAandB        = 0x44444444,
  228.     kQ3CSGEquationnAaBorCanB    = 0x74747474
  229. };
  230. typedef enum TQ3CSGEquation TQ3CSGEquation;
  231.  
  232. EXTERN_API_C( TQ3Status )
  233. Q3InteractiveRenderer_SetCSGEquation (TQ3RendererObject  renderer,
  234.                                  TQ3CSGEquation         equation);
  235.  
  236. EXTERN_API_C( TQ3Status )
  237. Q3InteractiveRenderer_GetCSGEquation (TQ3RendererObject  renderer,
  238.                                  TQ3CSGEquation *        equation);
  239.  
  240. EXTERN_API_C( TQ3Status )
  241. Q3InteractiveRenderer_SetPreferences (TQ3RendererObject  renderer,
  242.                                  long                     vendorID,
  243.                                  long                     engineID);
  244.  
  245. EXTERN_API_C( TQ3Status )
  246. Q3InteractiveRenderer_GetPreferences (TQ3RendererObject  renderer,
  247.                                  long *                    vendorID,
  248.                                  long *                    engineID);
  249.  
  250. EXTERN_API_C( TQ3Status )
  251. Q3InteractiveRenderer_SetDoubleBufferBypass (TQ3RendererObject  renderer,
  252.                                  TQ3Boolean             bypass);
  253.  
  254. EXTERN_API_C( TQ3Status )
  255. Q3InteractiveRenderer_GetDoubleBufferBypass (TQ3RendererObject  renderer,
  256.                                  TQ3Boolean *            bypass);
  257.  
  258. EXTERN_API_C( TQ3Status )
  259. Q3InteractiveRenderer_SetRAVEContextHints (TQ3RendererObject  renderer,
  260.                                  unsigned long             RAVEContextHints);
  261.  
  262. EXTERN_API_C( TQ3Status )
  263. Q3InteractiveRenderer_GetRAVEContextHints (TQ3RendererObject  renderer,
  264.                                  unsigned long *        RAVEContextHints);
  265.  
  266. EXTERN_API_C( TQ3Status )
  267. Q3InteractiveRenderer_SetRAVETextureFilter (TQ3RendererObject  renderer,
  268.                                  unsigned long             RAVEtextureFilterValue);
  269.  
  270. EXTERN_API_C( TQ3Status )
  271. Q3InteractiveRenderer_GetRAVETextureFilter (TQ3RendererObject  renderer,
  272.                                  unsigned long *        RAVEtextureFilterValue);
  273.  
  274.  
  275. /******************************************************************************
  276.  **                                                                             **
  277.  **                            Renderer View Tools                                 **
  278.  **                                                                             **
  279.  **                    You may only call these methods from a plug-in             **
  280.  **                                                                             **
  281.  *****************************************************************************/
  282. /*
  283.  *    Call by a renderer to call the user "idle" method, with progress 
  284.  *    information.
  285.  *    
  286.  *    Pass in (view, 0, n) on first call
  287.  *    Pass in (view, 1..n-1, n) during rendering
  288.  *    Pass in (view, n, n) upon completion
  289.  *    
  290.  *    Note: The user must have supplied an idleProgress method with 
  291.  *    Q3XView_SetIdleProgressMethod. Otherwise, the generic idle method is
  292.  *    called with no progress data. e.g. the Q3View_SetIdleMethod method
  293.  *    is called instead. (current and final are ignored, essentially.)
  294.  *
  295.  *    Returns kQ3Failure if rendering is cancelled.
  296.  */
  297. EXTERN_API_C( TQ3Status )
  298. Q3XView_IdleProgress            (TQ3ViewObject             view,
  299.                                  unsigned long             current,
  300.                                  unsigned long             completed);
  301.  
  302. /*
  303.  *    Called by an asynchronous renderer when it completes a frame.
  304.  */
  305. EXTERN_API_C( TQ3Status )
  306. Q3XView_EndFrame                (TQ3ViewObject             view);
  307.  
  308.  
  309. /******************************************************************************
  310.  **                                                                             **
  311.  **                            Renderer AttributeSet Tools                         **
  312.  **                                                                             **
  313.  **                    You may only call these methods from a plug-in             **
  314.  **                                                                             **
  315.  *****************************************************************************/
  316. /*
  317.  *    Faster access to geometry attribute sets.
  318.  *    
  319.  *    Returns pointer to INTERNAL data structure for elements and attributes
  320.  *    in an attributeSet, or NULL if no attribute exists.
  321.  *    
  322.  *    For attributes of type kQ3AttributeType..., the internal data structure
  323.  *    is identical to the data structure used in Q3AttributeSet_Add.
  324.  */
  325. EXTERN_API_C( void *)
  326. Q3XAttributeSet_GetPointer        (TQ3AttributeSet         attributeSet,
  327.                                  TQ3AttributeType         attributeType);
  328.  
  329.  
  330.  
  331. enum {
  332.     kQ3XAttributeMaskNone        = 0L,
  333.     kQ3XAttributeMaskSurfaceUV    = 1 << (kQ3AttributeTypeSurfaceUV - 1),
  334.     kQ3XAttributeMaskShadingUV    = 1 << (kQ3AttributeTypeShadingUV - 1),
  335.     kQ3XAttributeMaskNormal        = 1 << (kQ3AttributeTypeNormal - 1),
  336.     kQ3XAttributeMaskAmbientCoefficient = 1 << (kQ3AttributeTypeAmbientCoefficient - 1),
  337.     kQ3XAttributeMaskDiffuseColor = 1 << (kQ3AttributeTypeDiffuseColor - 1),
  338.     kQ3XAttributeMaskSpecularColor = 1 << (kQ3AttributeTypeSpecularColor - 1),
  339.     kQ3XAttributeMaskSpecularControl = 1 << (kQ3AttributeTypeSpecularControl - 1),
  340.     kQ3XAttributeMaskTransparencyColor = 1 << (kQ3AttributeTypeTransparencyColor - 1),
  341.     kQ3XAttributeMaskSurfaceTangent = 1 << (kQ3AttributeTypeSurfaceTangent - 1),
  342.     kQ3XAttributeMaskHighlightState = 1 << (kQ3AttributeTypeHighlightState - 1),
  343.     kQ3XAttributeMaskSurfaceShader = 1 << (kQ3AttributeTypeSurfaceShader - 1),
  344.     kQ3XAttributeMaskCustomAttribute = (long)0x80000000,
  345.     kQ3XAttributeMaskAll        = (long)0x800007FF,
  346.     kQ3XAttributeMaskInherited    = 0x03FF,
  347.     kQ3XAttributeMaskInterpolated = kQ3XAttributeMaskSurfaceUV | kQ3XAttributeMaskShadingUV | kQ3XAttributeMaskNormal | kQ3XAttributeMaskAmbientCoefficient | kQ3XAttributeMaskDiffuseColor | kQ3XAttributeMaskSpecularColor | kQ3XAttributeMaskSpecularControl | kQ3XAttributeMaskTransparencyColor | kQ3XAttributeMaskSurfaceTangent
  348. };
  349.  
  350.  
  351. typedef unsigned long                     TQ3XAttributeMask;
  352. EXTERN_API_C( TQ3XAttributeMask )
  353. Q3XAttributeSet_GetMask            (TQ3AttributeSet         attributeSet);
  354.  
  355.  
  356. /******************************************************************************
  357.  **                                                                             **
  358.  **                            Renderer Draw Context Tools                         **
  359.  **                                                                             **
  360.  *****************************************************************************/
  361. typedef struct OpaqueTQ3XDrawRegion*     TQ3XDrawRegion;
  362. EXTERN_API_C( TQ3Status )
  363. Q3XDrawContext_GetDrawRegion    (TQ3DrawContextObject     drawContext,
  364.                                  TQ3XDrawRegion *        drawRegion);
  365.  
  366.  
  367. enum TQ3XDrawContextValidationMasks {
  368.     kQ3XDrawContextValidationClearFlags = 0x00000000,
  369.     kQ3XDrawContextValidationDoubleBuffer = 1 << 0,
  370.     kQ3XDrawContextValidationShader = 1 << 1,
  371.     kQ3XDrawContextValidationClearFunction = 1 << 2,
  372.     kQ3XDrawContextValidationActiveBuffer = 1 << 3,
  373.     kQ3XDrawContextValidationInternalOffScreen = 1 << 4,
  374.     kQ3XDrawContextValidationPane = 1 << 5,
  375.     kQ3XDrawContextValidationMask = 1 << 6,
  376.     kQ3XDrawContextValidationDevice = 1 << 7,
  377.     kQ3XDrawContextValidationWindow = 1 << 8,
  378.     kQ3XDrawContextValidationWindowSize = 1 << 9,
  379.     kQ3XDrawContextValidationWindowClip = 1 << 10,
  380.     kQ3XDrawContextValidationWindowPosition = 1 << 11,
  381.     kQ3XDrawContextValidationPlatformAttributes = 1 << 12,
  382.     kQ3XDrawContextValidationForegroundShader = 1 << 13,
  383.     kQ3XDrawContextValidationBackgroundShader = 1 << 14,
  384.     kQ3XDrawContextValidationColorPalette = 1 << 15,
  385.     kQ3XDrawContextValidationAll = (long)0xFFFFFFFF
  386. };
  387. typedef enum TQ3XDrawContextValidationMasks TQ3XDrawContextValidationMasks;
  388.  
  389. typedef unsigned long                     TQ3XDrawContextValidation;
  390. EXTERN_API_C( TQ3Status )
  391. Q3XDrawContext_ClearValidationFlags (TQ3DrawContextObject  drawContext);
  392.  
  393. EXTERN_API_C( TQ3Status )
  394. Q3XDrawContext_GetValidationFlags (TQ3DrawContextObject  drawContext,
  395.                                  TQ3XDrawContextValidation * validationFlags);
  396.  
  397.  
  398. /******************************************************************************
  399.  **                                                                             **
  400.  **                            Renderer Draw Region Tools                         **
  401.  **                                                                             **
  402.  *****************************************************************************/
  403.  
  404. enum TQ3XDevicePixelType {
  405.                                                                 /* These do not indicate byte ordering   */
  406.     kQ3XDevicePixelTypeInvalid    = 0,                            /* Unknown, un-initialized type     */
  407.     kQ3XDevicePixelTypeRGB32    = 1,                            /* Alpha:8 (ignored), R:8, G:8, B:8 */
  408.     kQ3XDevicePixelTypeARGB32    = 2,                            /* Alpha:8, R:8, G:8, B:8              */
  409.     kQ3XDevicePixelTypeRGB24    = 3,                            /* 24 bits/pixel, R:8, G:8, B:8     */
  410.     kQ3XDevicePixelTypeRGB16    = 4,                            /* Alpha:1 (ignored), R:5, G:5, B:5 */
  411.     kQ3XDevicePixelTypeARGB16    = 5,                            /* Alpha:1, R:5, G:5, B:5              */
  412.     kQ3XDevicePixelTypeRGB16_565 = 6,                            /* 16 bits/pixel, R:5, G:6, B:5     */
  413.     kQ3XDevicePixelTypeIndexed8    = 7,                            /* 8-bit color table index             */
  414.     kQ3XDevicePixelTypeIndexed4    = 8,                            /* 4-bit color table index             */
  415.     kQ3XDevicePixelTypeIndexed2    = 9,                            /* 2-bit color table index             */
  416.     kQ3XDevicePixelTypeIndexed1    = 10                            /* 1-bit color table index             */
  417. };
  418. typedef enum TQ3XDevicePixelType TQ3XDevicePixelType;
  419.  
  420.  
  421. enum TQ3XClipMaskState {
  422.     kQ3XClipMaskFullyExposed    = 0,
  423.     kQ3XClipMaskPartiallyExposed = 1,
  424.     kQ3XClipMaskNotExposed        = 2
  425. };
  426. typedef enum TQ3XClipMaskState TQ3XClipMaskState;
  427.  
  428.  
  429. struct TQ3XColorDescriptor {
  430.     unsigned long                     redShift;
  431.     unsigned long                     redMask;
  432.     unsigned long                     greenShift;
  433.     unsigned long                     greenMask;
  434.     unsigned long                     blueShift;
  435.     unsigned long                     blueMask;
  436.     unsigned long                     alphaShift;
  437.     unsigned long                     alphaMask;
  438. };
  439. typedef struct TQ3XColorDescriptor        TQ3XColorDescriptor;
  440.  
  441. struct TQ3XDrawRegionDescriptor {
  442.     unsigned long                     width;
  443.     unsigned long                     height;
  444.     unsigned long                     rowBytes;
  445.     unsigned long                     pixelSize;
  446.     TQ3XDevicePixelType             pixelType;
  447.     TQ3XColorDescriptor             colorDescriptor;
  448.     TQ3Endian                         bitOrder;
  449.     TQ3Endian                         byteOrder;
  450.     TQ3Bitmap *                        clipMask;
  451. };
  452. typedef struct TQ3XDrawRegionDescriptor    TQ3XDrawRegionDescriptor;
  453.  
  454. enum TQ3XDrawRegionServicesMasks {
  455.     kQ3XDrawRegionServicesNoneFlag = 0L,
  456.     kQ3XDrawRegionServicesClearFlag = 1 << 0,
  457.     kQ3XDrawRegionServicesDontLockDDSurfaceFlag = 1 << 1
  458. };
  459. typedef enum TQ3XDrawRegionServicesMasks TQ3XDrawRegionServicesMasks;
  460.  
  461.  
  462. typedef unsigned long                     TQ3XDrawRegionServices;
  463. typedef CALLBACK_API_C( void , TQ3XDrawRegionRendererPrivateDeleteMethod )(void *rendererPrivate);
  464. EXTERN_API_C( TQ3Status )
  465. Q3XDrawRegion_GetDeviceScaleX    (TQ3XDrawRegion         drawRegion,
  466.                                  float *                deviceScaleX);
  467.  
  468. EXTERN_API_C( TQ3Status )
  469. Q3XDrawRegion_GetDeviceScaleY    (TQ3XDrawRegion         drawRegion,
  470.                                  float *                deviceScaleY);
  471.  
  472.  
  473. EXTERN_API_C( TQ3Status )
  474. Q3XDrawRegion_GetDeviceOffsetX    (TQ3XDrawRegion         drawRegion,
  475.                                  float *                deviceOffsetX);
  476.  
  477. EXTERN_API_C( TQ3Status )
  478. Q3XDrawRegion_GetDeviceOffsetY    (TQ3XDrawRegion         drawRegion,
  479.                                  float *                deviceOffsetX);
  480.  
  481.  
  482. EXTERN_API_C( TQ3Status )
  483. Q3XDrawRegion_GetWindowScaleX    (TQ3XDrawRegion         drawRegion,
  484.                                  float *                windowScaleX);
  485.  
  486. EXTERN_API_C( TQ3Status )
  487. Q3XDrawRegion_GetWindowScaleY    (TQ3XDrawRegion         drawRegion,
  488.                                  float *                windowScaleY);
  489.  
  490.  
  491. EXTERN_API_C( TQ3Status )
  492. Q3XDrawRegion_GetWindowOffsetX    (TQ3XDrawRegion         drawRegion,
  493.                                  float *                windowOffsetX);
  494.  
  495. EXTERN_API_C( TQ3Status )
  496. Q3XDrawRegion_GetWindowOffsetY    (TQ3XDrawRegion         drawRegion,
  497.                                  float *                windowOffsetY);
  498.  
  499. EXTERN_API_C( TQ3Status )
  500. Q3XDrawRegion_IsActive            (TQ3XDrawRegion         drawRegion,
  501.                                  TQ3Boolean *            isActive);
  502.  
  503.  
  504. EXTERN_API_C( TQ3Status )
  505. Q3XDrawRegion_GetNextRegion        (TQ3XDrawRegion         drawRegion,
  506.                                  TQ3XDrawRegion *        nextDrawRegion);
  507.  
  508. /* 
  509.  *  One of the next two functions must be called before using a draw region 
  510.  */
  511. /*
  512.  *    Use this Start function if double buffering/image access services from the
  513.  *    Draw Context are not needed, you may still request clear for example
  514.  */
  515. EXTERN_API_C( TQ3Status )
  516. Q3XDrawRegion_Start                (TQ3XDrawRegion         drawRegion,
  517.                                  TQ3XDrawRegionServices  services,
  518.                                  TQ3XDrawRegionDescriptor ** descriptor);
  519.  
  520. /*
  521.  *    Use this Start function if double buffering or image access services from 
  522.  *  the Draw Context are needed.
  523.  */
  524. EXTERN_API_C( TQ3Status )
  525. Q3XDrawRegion_StartAccessToImageBuffer (TQ3XDrawRegion     drawRegion,
  526.                                  TQ3XDrawRegionServices  services,
  527.                                  TQ3XDrawRegionDescriptor ** descriptor,
  528.                                  void **                image);
  529.  
  530. /*
  531.  *    This function is used to indicate that access to a DrawRegion is ended.
  532.  */
  533. EXTERN_API_C( TQ3Status )
  534. Q3XDrawRegion_End                (TQ3XDrawRegion         drawRegion);
  535.  
  536. EXTERN_API_C( TQ3Status )
  537. Q3XDrawRegion_GetDeviceTransform (TQ3XDrawRegion         drawRegion,
  538.                                  TQ3Matrix4x4 **        deviceTransform);
  539.  
  540. EXTERN_API_C( TQ3Status )
  541. Q3XDrawRegion_GetClipFlags        (TQ3XDrawRegion         drawRegion,
  542.                                  TQ3XClipMaskState *    clipMaskState);
  543.  
  544. EXTERN_API_C( TQ3Status )
  545. Q3XDrawRegion_GetClipMask        (TQ3XDrawRegion         drawRegion,
  546.                                  TQ3Bitmap **            clipMask);
  547.  
  548. #if TARGET_OS_MAC
  549. EXTERN_API_C( TQ3Status )
  550. Q3XDrawRegion_GetClipRegion        (TQ3XDrawRegion         drawRegion,
  551.                                  RgnHandle *            rgnHandle);
  552.  
  553. EXTERN_API_C( TQ3Status )
  554. Q3XDrawRegion_GetGDHandle        (TQ3XDrawRegion         drawRegion,
  555.                                  GDHandle *                gdHandle);
  556.  
  557. #endif  /* TARGET_OS_MAC */
  558.  
  559. EXTERN_API_C( TQ3Status )
  560. Q3XDrawRegion_GetRendererPrivate (TQ3XDrawRegion         drawRegion,
  561.                                  void **                rendererPrivate);
  562.  
  563. EXTERN_API_C( TQ3Status )
  564. Q3XDrawRegion_SetRendererPrivate (TQ3XDrawRegion         drawRegion,
  565.                                  const void *            rendererPrivate,
  566.                                  TQ3XDrawRegionRendererPrivateDeleteMethod  deleteMethod);
  567.  
  568. EXTERN_API_C( TQ3Status )
  569. Q3XDrawRegion_SetUseDefaultRendererFlag (TQ3XDrawRegion  drawRegion,
  570.                                  TQ3Boolean             flag);
  571.  
  572. EXTERN_API_C( TQ3Status )
  573. Q3XDrawRegion_GetUseDefaultRendererFlag (TQ3XDrawRegion  drawRegion,
  574.                                  TQ3Boolean *            useDefaultRenderingFlag);
  575.  
  576.  
  577.  
  578. /******************************************************************************
  579.  **                                                                             **
  580.  **                            Renderer Class Methods                             **
  581.  **                                                                             **
  582.  *****************************************************************************/
  583. /*
  584.  *    Methods from Object
  585.  *        kQ3XMethodTypeObjectClassRegister
  586.  *        kQ3XMethodTypeObjectClassUnregister
  587.  *        kQ3XMethodTypeObjectNew
  588.  *        kQ3XMethodTypeObjectDelete
  589.  *        kQ3XMethodTypeObjectRead
  590.  *        kQ3XMethodTypeObjectTraverse
  591.  *        kQ3XMethodTypeObjectWrite
  592.  *        
  593.  *    Methods from Shared
  594.  *        kQ3MethodTypeSharedEdited
  595.  *
  596.  *    Renderer Methods
  597.  *    
  598.  *    The renderer methods should be implemented according to the type
  599.  *    of renderer being written.
  600.  *
  601.  *    For the purposes of documentation, there are two basic types of
  602.  *    renderers: 
  603.  *
  604.  *        Interactive
  605.  *            Interactive Renderer
  606.  *            WireFrame Renderer
  607.  *        
  608.  *        Deferred
  609.  *            a ray-tracer
  610.  *            painter's algorithm renderer (cached in a BSP triangle tree)
  611.  *            an artistic renderer (simulates a pencil drawing, etc.)
  612.  *
  613.  *    The main difference is how each renderer handles incoming state and 
  614.  *    geometry.
  615.  *
  616.  *    An interactive renderer immediately transforms, culls, and shades
  617.  *    incoming geometry and performs rasterization. For example, in a 
  618.  *    single-buffered WireFrame renderer, you will see a new triangle
  619.  *    immediately after Q3Triangle_Draw (if it's visible, of course).
  620.  *
  621.  *    A deferred renderer caches the view state and each geometry, 
  622.  *    converting into any internal queue of drawing commands. Rasterization
  623.  *    is not actually performed until all data has been submitted.
  624.  *    
  625.  *    For example, a ray-tracer may not rasterize anything until the
  626.  *    end of the rendering loop, or until an EndFrame call is made.
  627.  */
  628.  
  629. /******************************************************************************
  630.  **                                                                             **
  631.  **                        Renderer User Interface Methods                         **
  632.  **                                                                             **
  633.  *****************************************************************************/
  634. /*
  635.  *    kQ3XMethodTypeRendererIsInteractive
  636.  *    
  637.  *    There is no actual method with this - the metahandler simply returns
  638.  *  "(TQ3XFunctionPointer)kQ3True" for this "method" if the renderer is 
  639.  *  intended to be used in interactive settings, and   
  640.  *    "(TQ3XFunctionPointer)kQ3False" otherwise. 
  641.  *  
  642.  *  If neither value is specified in the metahandler, the renderer 
  643.  *  is *assumed to be non-interactive*!!!
  644.  *    
  645.  *    OPTIONAL
  646.  */
  647.  
  648. enum {
  649.     kQ3XMethodTypeRendererIsInteractive = FOUR_CHAR_CODE('isin')
  650. };
  651.  
  652.  
  653. /*
  654.  *    TQ3XRendererModalConfigureMethod
  655.  *    
  656.  *    This method should pop up a modal dialog to edit the renderer settings 
  657.  *    found in the renderer private. 
  658.  *    
  659.  *    dialogAnchor - is platform specific data passed by the client to support
  660.  *      movable modal dialogs. 
  661.  *    MacOS: this is a callback to the calling application's event handler.
  662.  *      The renderer calls this function with events not handled by the 
  663.  *      settings dialog. This is necessary in order to support movable modal 
  664.  *      dialogs. An application's event handler must return kQ3True if it 
  665.  *      handles the event passed to the callback or kQ3False if not. 
  666.  *      An application which doesn't want to support a movable modal configure
  667.  *      dialog should pass NULL for the clientEventHandler of TQ3DialogAnchor.
  668.  *      A renderer should implement a non-movable style dialog in that case.
  669.  *    Win32: this is the HWND of the owning window (typically an application's
  670.  *      main window).  (Win32 application modal dialogs are always movable.)
  671.  *  canceled - returns a boolean inditacating that the user canceled the 
  672.  *    dialog.
  673.  *    
  674.  *    OPTIONAL
  675.  */
  676.  
  677. enum {
  678.     kQ3XMethodTypeRendererModalConfigure = FOUR_CHAR_CODE('rdmc')
  679. };
  680.  
  681. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererModalConfigureMethod )(TQ3RendererObject renderer, TQ3DialogAnchor dialogAnchor, TQ3Boolean *canceled, void *rendererPrivate);
  682. /*
  683.  *    kQ3XMethodTypeRendererGetNickNameString
  684.  *    
  685.  *        Allows an application to collect the name of the renderer for
  686.  *        display in a user interface item such as a menu.
  687.  *    
  688.  *        If dataBuffer is NULL actualDataSize returns the required size in 
  689.  *        bytes of a data buffer large enough to store the renderer name. 
  690.  *
  691.  *      bufferSize is the actual size of the memory block pointed to by 
  692.  *        dataBuffer
  693.  *
  694.  *        actualDataSize - on return the actual number of bytes written to the
  695.  *        buffer or if dataBuffer is NULL the required size of dataBuffer
  696.  *
  697.  *    OPTIONAL
  698.  */
  699.  
  700. enum {
  701.     kQ3XMethodTypeRendererGetNickNameString = FOUR_CHAR_CODE('rdns')
  702. };
  703.  
  704. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererGetNickNameStringMethod )(unsigned char *dataBuffer, unsigned long bufferSize, unsigned long *actualDataSize);
  705. /*
  706.  *    kQ3XMethodTypeRendererGetConfigurationData
  707.  *    
  708.  *        Allows an application to collect private configuration data from the
  709.  *      renderer which it will then save. For example in a preference file, 
  710.  *      a registry key (on Windows) or in a style template. An application 
  711.  *      should tag this data with the renderer's object name.
  712.  *    
  713.  *        If dataBuffer is NULL actualDataSize returns the required size in 
  714.  *        bytes of a data buffer large enough to store private data. 
  715.  *
  716.  *      bufferSize is the actual size of the memory block pointed to by 
  717.  *        dataBuffer
  718.  *
  719.  *        actualDataSize - on return the actual number of bytes written to the
  720.  *        buffer or if dataBuffer is NULL the required size of dataBuffer
  721.  *
  722.  *    OPTIONAL
  723.  */
  724.  
  725. enum {
  726.     kQ3XMethodTypeRendererGetConfigurationData = FOUR_CHAR_CODE('rdgp')
  727. };
  728.  
  729. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererGetConfigurationDataMethod )(TQ3RendererObject renderer, unsigned char *dataBuffer, unsigned long bufferSize, unsigned long *actualDataSize, void *rendererPrivate);
  730. /*
  731.  *    TQ3XRendererSetConfigurationDataMethod
  732.  *    
  733.  *        Allows an application to pass private configuration data which has
  734.  *         previously  been obtained from a renderer via 
  735.  *        Q3Renderer_GetConfigurationData. For example in a preference file or 
  736.  *        in a style template. An application should tag this data with the 
  737.  *        renderer's object name.
  738.  *    
  739.  *      bufferSize is the actual size of the memory block pointed to by 
  740.  *        dataBuffer
  741.  *
  742.  *    OPTIONAL
  743.  */
  744.  
  745. enum {
  746.     kQ3XMethodTypeRendererSetConfigurationData = FOUR_CHAR_CODE('rdsp')
  747. };
  748.  
  749. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSetConfigurationDataMethod )(TQ3RendererObject renderer, unsigned char *dataBuffer, unsigned long bufferSize, void *rendererPrivate);
  750. /******************************************************************************
  751.  **                                                                             **
  752.  **                        Renderer Drawing State Methods                         **
  753.  **                                                                             **
  754.  *****************************************************************************/
  755. /*
  756.  *    TQ3RendererStartFrame
  757.  *    
  758.  *    The StartFrame method is called first at Q3View_StartRendering
  759.  *    and should:
  760.  *        - initialize any renderer state to defaults
  761.  *        - extract any and all useful data from the drawContext
  762.  *
  763.  *    If your renderer passed in kQ3RendererFlagClearBuffer at 
  764.  *    registration, then it should also:
  765.  *        - clear the drawContext 
  766.  *    
  767.  *        When clearing, your renderer may opt to:
  768.  *        - NOT clear anything (if you touch every pixel, for example)
  769.  *        - to clear with your own routine, or
  770.  *        - to use the draw context default clear method by calling 
  771.  *        Q3DrawContext_Clear. Q3DrawContext_Clear takes advantage of
  772.  *        any available hardware in the system for clearing.
  773.  *    
  774.  *    This call also signals the start of all default submit commands from
  775.  *    the view. The renderer will receive updates for the default view
  776.  *    state via its Update methods before StartPass is called.
  777.  *    
  778.  *    REQUIRED
  779.  */
  780.  
  781. enum {
  782.     kQ3XMethodTypeRendererStartFrame = FOUR_CHAR_CODE('rdcl')
  783. };
  784.  
  785. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererStartFrameMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3DrawContextObject drawContext);
  786. /*
  787.  *    kQ3XMethodTypeRendererStartPass
  788.  *    TQ3XRendererStartPassMethod
  789.  *    
  790.  *    The StartPass method is called during Q3View_StartRendering but after
  791.  *    the StartFrame command. It should:
  792.  *        - collect camera and light information
  793.  *    
  794.  *    If your renderer supports deferred camera transformation, camera is the
  795.  *    main camera which will be submitted in the hierarchy somewhere. It
  796.  *    is never NULL.
  797.  *
  798.  *    If your renderer does not support deferred camera transformation, camera
  799.  *    is the transformed camera.
  800.  *
  801.  *    If your renderer supports deferred light transformation, lights will be
  802.  *    NULL, and will be submitted to your light draw methods instead.
  803.  *
  804.  *    This call signals the end of the default update state, and the start of 
  805.  *  submit commands from the user to the view.
  806.  *
  807.  *    REQUIRED
  808.  */
  809.  
  810. enum {
  811.     kQ3XMethodTypeRendererStartPass = FOUR_CHAR_CODE('rdst')
  812. };
  813.  
  814. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererStartPassMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3CameraObject camera, TQ3GroupObject lightGroup);
  815. /*
  816.  *    kQ3XMethodTypeRendererFlushFrame
  817.  *    TQ3XRendererFlushFrameMethod
  818.  *    
  819.  *    This call is only implemented by asynchronous renderers.
  820.  *    
  821.  *    The FlushFrame method is called between the StartPass and EndPass
  822.  *    methods and is called when the user wishes to flush any asynchronous
  823.  *    drawing tasks (which draw to the drawcontext), but does not want 
  824.  *    to block.
  825.  *    
  826.  *    The result of this call is that an image should "eventually" appear
  827.  *    asynchronously.
  828.  *    
  829.  *    For asynchronous rendering, this call is non-blocking.
  830.  *    
  831.  *    An interactive renderer should ensure that all received
  832.  *    geometries are drawn in the image.
  833.  *    
  834.  *    An interactive renderer that talks to hardware should force
  835.  *    the hardware to generate an image.
  836.  *    
  837.  *    A deferred renderer should exhibit a similar behaviour,
  838.  *    though it is not required.  A deferred renderer should spawn
  839.  *    a process that generates a partial image from the currently
  840.  *    accumulated drawing state. 
  841.  *    
  842.  *    However, for renderers such as ray-tracers which generally are
  843.  *    quite compute-intensive, FlushFrame is not required and is a no-op.
  844.  *
  845.  *    OPTIONAL
  846.  */
  847.  
  848. enum {
  849.     kQ3XMethodTypeRendererFlushFrame = FOUR_CHAR_CODE('rdfl')
  850. };
  851.  
  852. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererFlushFrameMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3DrawContextObject drawContext);
  853. /*
  854.  *    kQ3XMethodTypeRendererEndPass
  855.  *    TQ3XRendererEndPassMethod
  856.  *    
  857.  *    The EndPass method is called at Q3View_EndRendering and signals
  858.  *    the end of submit commands to the view.
  859.  *
  860.  *    If an error occurs, the renderer should call Q3XError_Post and
  861.  *    return kQ3ViewStatusError.
  862.  *    
  863.  *    If a renderer requires another pass on the renderering data,
  864.  *    it should return kQ3ViewStatusRetraverse.
  865.  *    
  866.  *    If rendering was cancelled, this function will not be called
  867.  *    and the view will handle returning kQ3ViewStatusCancelled;
  868.  *    
  869.  *    Otherwise, your renderer should begin completing the process of 
  870.  *    generating the image in the drawcontext. If you have buffered
  871.  *    any drawing data, flush it. RendererEnd should have a similar
  872.  *    effect as RendererFlushFrame.
  873.  *    
  874.  *    If the renderer is synchronous:
  875.  *        - complete rendering of the entire frame
  876.  *        if the renderer supports kQ3RendererClassSupportDoubleBuffer
  877.  *            - Update the front buffer
  878.  *        else
  879.  *            - DrawContext will update the front buffer after returning
  880.  *
  881.  *    If the renderer is asynchronous
  882.  *        - spawn rendering thread for entire frame
  883.  *        if the renderer supports kQ3RendererClassSupportDoubleBuffer,
  884.  *            - you must eventually update the front buffer asynchronously
  885.  *        else
  886.  *            - you must eventually update the back buffer asynchronously
  887.  *            
  888.  *    REQUIRED
  889.  */
  890.  
  891. enum {
  892.     kQ3XMethodTypeRendererEndPass = FOUR_CHAR_CODE('rded')
  893. };
  894.  
  895. typedef CALLBACK_API_C( TQ3ViewStatus , TQ3XRendererEndPassMethod )(TQ3ViewObject view, void *rendererPrivate);
  896. /*
  897.  *    kQ3XMethodTypeRendererEndFrame
  898.  *    TQ3XRendererEndFrame
  899.  *    
  900.  *    This call is only implemented by asynchronous renderers.
  901.  *
  902.  *    The EndFrame method is called from Q3View_Sync, which is
  903.  *    called after Q3View_EndRendering and signals that the user
  904.  *    wishes to see the completed image and is willing to block.
  905.  *    
  906.  *    If your renderer supports kQ3RendererFlagDoubleBuffer
  907.  *        - update the front buffer completely 
  908.  *    else
  909.  *        - update the back buffer completely
  910.  *
  911.  *    This call is equivalent in functionality to RendererFlushFrame
  912.  *    but blocks until the image is completed.
  913.  *    
  914.  *    If no method is supplied, the default is a no-op.
  915.  *    
  916.  *    NOTE: Registering a method of this type indicates that your renderer will
  917.  *    be rendering after Q3View_EndRendering has been called.
  918.  *    
  919.  *    OPTIONAL
  920.  */
  921.  
  922. enum {
  923.     kQ3XMethodTypeRendererEndFrame = FOUR_CHAR_CODE('rdsy')
  924. };
  925.  
  926. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererEndFrameMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3DrawContextObject drawContext);
  927. /*
  928.  *    The RendererCancel method is called after Q3View_StartRendering
  929.  *    and signals the termination of all rendering operations.
  930.  *
  931.  *    A renderer should clean up any cached data, and cancel all 
  932.  *    rendering operations.
  933.  *    
  934.  *    If called before Q3View_EndRendering, the RendererEnd method
  935.  *    is NOT called.
  936.  *    
  937.  *    If called after Q3View_EndRendering, the renderer should kill
  938.  *    any threads and terminate any further rendering.
  939.  *    
  940.  *    REQUIRED
  941.  */
  942.  
  943. enum {
  944.     kQ3XMethodTypeRendererCancel = FOUR_CHAR_CODE('rdab')
  945. };
  946.  
  947. typedef CALLBACK_API_C( void , TQ3XRendererCancelMethod )(TQ3ViewObject view, void *rendererPrivate);
  948. /******************************************************************************
  949.  **                                                                             **
  950.  **                        Renderer DrawContext Methods                         **
  951.  **                                                                             **
  952.  *****************************************************************************/
  953. /*
  954.  *    kQ3XMethodTypeRendererPush
  955.  *    TQ3XRendererPushMethod
  956.  *    
  957.  *    kQ3XMethodTypeRendererPop
  958.  *    TQ3XRendererPopMethod
  959.  *    
  960.  *    These methods are called whenever the graphics state in the view
  961.  *    is pushed or popped. The user may isolate state by calling:
  962.  *    
  963.  *    Q3Attribute_Submit(kQ3AttributeTypeDiffuseColor, &red, view);
  964.  *    Q3Attribute_Submit(kQ3AttributeTypeTransparencyColor, &blue, view);
  965.  *    Q3Attribute_Submit(kQ3AttributeTypeSpecularColor, &white, view);
  966.  *    Q3Box_Submit(&unitBox, view);
  967.  *    Q3TranslateTransform_Submit(&unitVector, view);
  968.  *    Q3Push_Submit(view);
  969.  *        Q3Attribute_Submit(kQ3AttributeTypeDiffuseColor, &blue, view);
  970.  *        Q3Attribute_Submit(kQ3AttributeTypeTransparencyColor, &green, view);
  971.  *        Q3Box_Submit(&unitBox, view);
  972.  *    Q3Pop_Submit(view);    
  973.  *    Q3TranslateTransform_Submit(&unitVector, view);
  974.  *    Q3Box_Submit(&unitBox, view);
  975.  *    
  976.  *    or by submitting a display group which pushes and pops.
  977.  *    
  978.  *    If you support RendererPush and RendererPop in your renderer:
  979.  *        - you must maintain your drawing state as a stack, as well.
  980.  *        - you will not be updated with the popped state after
  981.  *            RendererPop is called.
  982.  *
  983.  *    If you do not support Push and Pop in your renderer:
  984.  *        - you may maintain a single copy of the drawing state.
  985.  *        - you will be updated with changed fields after the view stack is
  986.  *            popped.
  987.  *
  988.  *    A renderer that supports Push and Pop gets called in the following
  989.  *    sequence (from example above):
  990.  *    
  991.  *    RendererUpdateAttributeDiffuseColor(&red,...)
  992.  *    RendererUpdateAttributeTransparencyColor(&blue,...)
  993.  *    RendererUpdateAttributeSpecularColor(&white,...)
  994.  *    RendererUpdateMatrixLocalToWorld(...)
  995.  *    RendererSubmitGeometryBox(...)
  996.  *    RendererPush(...)
  997.  *        RendererUpdateAttributeDiffuseColor(&blue,...)
  998.  *        RendererUpdateAttributeTransparencyColor(&green,...)
  999.  *        RendererSubmitGeometryBox(...)
  1000.  *    RendererPop(...)
  1001.  *    RendererUpdateMatrixLocalToWorld(...)
  1002.  *    RendererSubmitGeometryBox(...)
  1003.  *
  1004.  *    A renderer that does not supports Push and Pop gets called in the
  1005.  *    following sequence:
  1006.  *    
  1007.  *    RendererUpdateAttributeDiffuseColor(&red,...)
  1008.  *    RendererUpdateAttributeTransparencyColor(&blue,...)
  1009.  *    RendererUpdateAttributeSpecularColor(&white,...)
  1010.  *    RendererUpdateMatrixLocalToWorld(...)
  1011.  *    RendererSubmitGeometryBox(...)
  1012.  *        RendererUpdateAttributeDiffuseColor(&blue,...)
  1013.  *        RendererUpdateAttributeTransparencyColor(&green,...)
  1014.  *        RendererSubmitGeometryBox(...)
  1015.  *    RendererUpdateAttributeDiffuseColor(&red,...)
  1016.  *    RendererUpdateAttributeTransparencyColor(&blue,...)
  1017.  *    RendererUpdateMatrixLocalToWorld(...)
  1018.  *    RendererSubmitGeometryBox(...)
  1019.  *    
  1020.  */
  1021.  
  1022. enum {
  1023.     kQ3XMethodTypeRendererPush    = FOUR_CHAR_CODE('rdps')
  1024. };
  1025.  
  1026. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererPushMethod )(TQ3ViewObject view, void *rendererPrivate);
  1027.  
  1028. enum {
  1029.     kQ3XMethodTypeRendererPop    = FOUR_CHAR_CODE('rdpo')
  1030. };
  1031.  
  1032. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererPopMethod )(TQ3ViewObject view, void *rendererPrivate);
  1033. /******************************************************************************
  1034.  **                                                                             **
  1035.  **                            Renderer Cull Methods                             **
  1036.  **                                                                             **
  1037.  *****************************************************************************/
  1038. /*
  1039.  *    kQ3XMethodTypeRendererIsBoundingBoxVisible
  1040.  *    TQ3XRendererIsBoundingBoxVisibleMethod
  1041.  *    
  1042.  *    This method is called to cull complex groups and geometries 
  1043.  *    given their bounding box in local space.
  1044.  *    
  1045.  *    It should transform the local-space bounding box coordinates to
  1046.  *    frustum space and return a TQ3Boolean return value indicating
  1047.  *    whether the box appears within the viewing frustum.
  1048.  *    
  1049.  *    If no method is supplied, the default behavior is to return
  1050.  *    kQ3True.
  1051.  *    
  1052.  */
  1053.  
  1054. enum {
  1055.     kQ3XMethodTypeRendererIsBoundingBoxVisible = FOUR_CHAR_CODE('rdbx')
  1056. };
  1057.  
  1058. typedef CALLBACK_API_C( TQ3Boolean , TQ3XRendererIsBoundingBoxVisibleMethod )(TQ3ViewObject view, void *rendererPrivate, const TQ3BoundingBox *bBox);
  1059.  
  1060. /******************************************************************************
  1061.  **                                                                             **
  1062.  **                        Renderer Object Support Methods                         **
  1063.  **                                                                             **
  1064.  *****************************************************************************/
  1065. /*
  1066.  *    Drawing methods (Geometry, Camera, Lights)
  1067.  *
  1068.  */
  1069. /*
  1070.  *    Geometry MetaHandler
  1071.  *    
  1072.  *    This metaHandler is required to support 
  1073.  *    
  1074.  *    kQ3GeometryTypeTriangle
  1075.  *    kQ3GeometryTypeLine
  1076.  *    kQ3GeometryTypePoint
  1077.  *    kQ3GeometryTypeMarker
  1078.  *    kQ3GeometryTypePixmapMarker
  1079.  *    
  1080.  *    REQUIRED
  1081.  */
  1082.  
  1083. enum {
  1084.     kQ3XMethodTypeRendererSubmitGeometryMetaHandler = FOUR_CHAR_CODE('rdgm')
  1085. };
  1086.  
  1087. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererSubmitGeometryMetaHandlerMethod )(TQ3ObjectType geometryType);
  1088. /*
  1089.  *    The TQ3XRendererSubmitGeometryMetaHandlerMethod switches on geometryType
  1090.  *    of kQ3GeometryTypeFoo and returns methods of type:
  1091.  */
  1092. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSubmitGeometryMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3GeometryObject geometry, const void *publicData);
  1093. /*
  1094.  *    Camera MetaHandler
  1095.  *    
  1096.  *    This metaHandler, if supplied, indicates that your renderer
  1097.  *    handles deferred transformation of the main camera within a scene.
  1098.  *    
  1099.  *    If not supplied, or an unsupported camera is used, the view will do
  1100.  *    the transformation for the renderer and pass in a camera in the 
  1101.  *    StartPass method.
  1102.  *    
  1103.  *    OPTIONAL
  1104.  */
  1105.  
  1106. enum {
  1107.     kQ3XMethodTypeRendererSubmitCameraMetaHandler = FOUR_CHAR_CODE('rdcm')
  1108. };
  1109.  
  1110. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererSubmitCameraMetaHandlerMethod )(TQ3ObjectType cameraType);
  1111. /*
  1112.  *    The TQ3XRendererSubmitCameraMetaHandlerMethod switches on cameraType
  1113.  *    of kQ3CameraTypeFoo and returns methods of type:
  1114.  */
  1115. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSubmitCameraMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3CameraObject camera, const void *publicData);
  1116. /*
  1117.  *    Light MetaHandler
  1118.  *    
  1119.  *    This metaHandler, if supplied, indicates that your renderer
  1120.  *    handles deferred transformation of lights within a scene.
  1121.  *    
  1122.  *    If an unsupported light is encountered, it is ignored.
  1123.  *
  1124.  *    OPTIONAL
  1125.  */
  1126.  
  1127. enum {
  1128.     kQ3XMethodTypeRendererSubmitLightMetaHandler = FOUR_CHAR_CODE('rdlg')
  1129. };
  1130.  
  1131. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererSubmitLightMetaHandlerMethod )(TQ3ObjectType lightType);
  1132. /*
  1133.  *    The TQ3XRendererSubmitLightMetaHandlerMethod switches on lightType
  1134.  *    of kQ3LightTypeFoo and returns methods of type:
  1135.  */
  1136. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSubmitLightMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3LightObject light, const void *publicData);
  1137. /*
  1138.  *
  1139.  *    Update methods
  1140.  *
  1141.  *    They are called whenever the state has changed. If the renderer supports
  1142.  *    the RendererPush and RendererPop methods, it must maintain its own state
  1143.  *    stack. Updates are not called for changed data when the view stack is
  1144.  *    popped.
  1145.  *
  1146.  *    See the comments for the RendererPush and RendererPop methods above
  1147.  *    for an example of how data is updated.
  1148.  *
  1149.  */
  1150. /*
  1151.  *    Style
  1152.  */
  1153.  
  1154. enum {
  1155.     kQ3XMethodTypeRendererUpdateStyleMetaHandler = FOUR_CHAR_CODE('rdyu')
  1156. };
  1157.  
  1158. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererUpdateStyleMetaHandlerMethod )(TQ3ObjectType styleType);
  1159. /*
  1160.  *    The TQ3XRendererUpdateStyleMetaHandlerMethod switches on styleType
  1161.  *    of kQ3StyleTypeFoo and returns methods of type:
  1162.  */
  1163. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateStyleMethod )(TQ3ViewObject view, void *rendererPrivate, const void *publicData);
  1164. /*
  1165.  *    Attributes
  1166.  */
  1167.  
  1168. enum {
  1169.     kQ3XMethodTypeRendererUpdateAttributeMetaHandler = FOUR_CHAR_CODE('rdau')
  1170. };
  1171.  
  1172. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererUpdateAttributeMetaHandlerMethod )(TQ3AttributeType attributeType);
  1173. /*
  1174.  *    The TQ3XRendererUpdateStyleMetaHandlerMethod switches on attributeType
  1175.  *    of kQ3AttributeTypeFoo and returns methods of type:
  1176.  */
  1177. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateAttributeMethod )(TQ3ViewObject view, void *rendererPrivate, const void *publicData);
  1178. /*
  1179.  *    Shaders
  1180.  */
  1181.  
  1182. enum {
  1183.     kQ3XMethodTypeRendererUpdateShaderMetaHandler = FOUR_CHAR_CODE('rdsu')
  1184. };
  1185.  
  1186. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererUpdateShaderMetaHandlerMethod )(TQ3ObjectType shaderType);
  1187. /*
  1188.  *    The TQ3XRendererUpdateShaderMetaHandlerMethod switches on shaderType
  1189.  *    of kQ3ShaderTypeFoo and returns methods of type:
  1190.  */
  1191. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateShaderMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3Object *shaderObject);
  1192. /*
  1193.  *    Matrices
  1194.  */
  1195.  
  1196. enum {
  1197.     kQ3XMethodTypeRendererUpdateMatrixMetaHandler = FOUR_CHAR_CODE('rdxu')
  1198. };
  1199.  
  1200. typedef TQ3XMetaHandler                 TQ3XRendererUpdateMatrixMetaHandlerMethod;
  1201. /*
  1202.  *    The TQ3XRendererUpdateShaderMetaHandlerMethod switches on methods
  1203.  *    of the form kQ3MethodTypeRendererUpdateMatrixFoo:
  1204.  */
  1205.  
  1206. enum {
  1207.     kQ3XMethodTypeRendererUpdateMatrixLocalToWorld = FOUR_CHAR_CODE('ulwx')
  1208. };
  1209.  
  1210.  
  1211. enum {
  1212.     kQ3XMethodTypeRendererUpdateMatrixLocalToWorldInverse = FOUR_CHAR_CODE('ulwi')
  1213. };
  1214.  
  1215.  
  1216. enum {
  1217.     kQ3XMethodTypeRendererUpdateMatrixLocalToWorldInverseTranspose = FOUR_CHAR_CODE('ulwt')
  1218. };
  1219.  
  1220.  
  1221. enum {
  1222.     kQ3XMethodTypeRendererUpdateMatrixLocalToCamera = FOUR_CHAR_CODE('ulcx')
  1223. };
  1224.  
  1225.  
  1226. enum {
  1227.     kQ3XMethodTypeRendererUpdateMatrixLocalToFrustum = FOUR_CHAR_CODE('ulfx')
  1228. };
  1229.  
  1230.  
  1231. enum {
  1232.     kQ3XMethodTypeRendererUpdateMatrixWorldToFrustum = FOUR_CHAR_CODE('uwfx')
  1233. };
  1234.  
  1235. /*
  1236.  *    and returns methods of type:
  1237.  */
  1238. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateMatrixMethod )(TQ3ViewObject view, void *rendererPrivate, const TQ3Matrix4x4 *matrix);
  1239.  
  1240.  
  1241. #if PRAGMA_ENUM_ALWAYSINT
  1242.     #pragma enumsalwaysint reset
  1243. #elif PRAGMA_ENUM_OPTIONS
  1244.     #pragma option enum=reset
  1245. #elif defined(PRAGMA_ENUM_PACK__QD3DRENDERER__)
  1246.     #pragma options(pack_enums)
  1247. #endif
  1248.  
  1249. #if PRAGMA_STRUCT_ALIGN
  1250.     #pragma options align=reset
  1251. #elif PRAGMA_STRUCT_PACKPUSH
  1252.     #pragma pack(pop)
  1253. #elif PRAGMA_STRUCT_PACK
  1254.     #pragma pack()
  1255. #endif
  1256.  
  1257. #ifdef PRAGMA_IMPORT_OFF
  1258. #pragma import off
  1259. #elif PRAGMA_IMPORT
  1260. #pragma import reset
  1261. #endif
  1262.  
  1263. #ifdef __cplusplus
  1264. }
  1265. #endif
  1266.  
  1267. #endif /* __QD3DRENDERER__ */
  1268.  
  1269.